from mongoengine import register_connection
import pymysql
import pymssql


def getMysqlConn(name):
    if name == 'local':
        return pymysql.connect(host="localhost", user="root", passwd="", port=3306, charset="utf8", db="real")


def getSqlServerConn(name):
    if name == '201':
        return pymssql.connect(host="192.168.1.201", user="sa", password="share2015db", charset="utf8",
                               database="ShareMedicalData")


register_connection(alias='mongo202', name='cms', host='192.168.1.202', port=27017)
register_connection(alias='mongo219', name='cms', host='114.215.158.219', port=37017)
register_connection(alias='mongo222', name='cms', host='192.168.1.222', port=27017)
register_connection(alias='mongo139', name='cms', host='139.129.192.160', port=27017)
